/* Base CSS Reset for Mobile Vue Project */

/* 1. 通用重置 */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 2. HTML根元素设置 */
html {
  font-size: 16px;
  /* 基础字体大小，配合 flexible.js 自动调整 */
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* 移除移动端点击高亮 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 3. body 样式重置 */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background-color: #fff;
  overflow-x: hidden;
  /* 防止横向滚动 */
  -webkit-overflow-scrolling: touch;
  /* iOS 平滑滚动 */
}

/* 4. 标题重置 */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  padding: 0;
  font-weight: normal;
  font-size: inherit;
}

/* 5. 段落重置 */
p {
  margin: 0;
  padding: 0;
}

/* 6. 列表重置 */
ul,
ol,
li {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 7. 链接重置 */
a {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
  -webkit-touch-callout: none;
  /* 禁用长按弹出菜单 */
}

a:active,
a:hover {
  outline: 0;
}

/* 8. 图片和媒体重置 */
img {
  border: 0;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  -ms-interpolation-mode: bicubic;
  /* IE 图片缩放优化 */
}

svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* 9. 表单元素重置 */
input,
button,
select,
textarea {
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  -webkit-appearance: none;
  /* 移除默认样式 */
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
  /* 移除 iOS 默认圆角 */
}

/* 特殊处理 iOS 输入框 */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
  -webkit-appearance: none;
  -webkit-border-radius: 0;
  border-radius: 0;
}

/* 按钮重置 */
button {
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  border: none;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

/* 10. 表格重置 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

th,
td {
  padding: 0;
  text-align: left;
}

/* 11. 其他元素重置 */
blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}

hr {
  border: 0;
  height: 1px;
  background: #eee;
  margin: 0;
}

/* 12. 移动端特殊优化 */

/* 解决移动端1px边框问题 */
.border-1px {
  position: relative;
}

.border-1px::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: #e5e5e5;
  transform: scaleY(0.5);
  transform-origin: 0 100%;
}

/* 清除浮动 */
.clearfix::after {
  content: '';
  display: table;
  clear: both;
}

/* 文本省略 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 13. 滚动条样式（WebKit内核） */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 14. 选择文本样式 */
::selection {
  background: #b3d4fc;
  text-shadow: none;
}

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

/* 15. 焦点样式重置 */
:focus {
  outline: none;
}

/* 16. 禁用用户选择（根据需要使用） */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 17. 移动端触摸优化 */
.touch-action-manipulation {
  touch-action: manipulation;
  /* 消除移动端点击延迟 */
}

/* 18. Flex 布局工具类 */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-around {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

/* 19. 隐藏工具类 */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden !important;
}

/* 20. 定位工具类 */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

/* 21. 移动端安全区域适配 */
.safe-area-inset-top {
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

.safe-area-inset-bottom {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-inset-left {
  padding-left: constant(safe-area-inset-left);
  padding-left: env(safe-area-inset-left);
}

.safe-area-inset-right {
  padding-right: constant(safe-area-inset-right);
  padding-right: env(safe-area-inset-right);
}

/* 22. 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
  .border-1px::after {
    transform: scaleY(0.5);
  }
}

@media (-webkit-min-device-pixel-ratio: 3),
(min-resolution: 288dpi) {
  .border-1px::after {
    transform: scaleY(0.33);
  }
}

/* 23. 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #ffffff;
  }

  .border-1px::after {
    background: #333333;
  }

  ::-webkit-scrollbar-track {
    background: #2a2a2a;
  }

  ::-webkit-scrollbar-thumb {
    background: #555555;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #777777;
  }
}

/* 24. 打印样式 */
@media print {

  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}